<?php $this->load->view('common/head');?>
		<form class="form-horizontal margin-top-10" name="add" id="add" action="<?php echo $this->input->server('REQUEST_URI'); ?>" method="post">
		  <input type="hidden" name="id" id="id" value="<?=$gxData['id']?>">
		  <input type="hidden" name="procId" id="procId" value="<?=$procId?>">
		  <input type="hidden" name="projectId" id="projectId" value="<?=$projectId?>">
		  <input type="hidden" name="isBubao" id="isBubao" value="<?=$isBubao?>">
			<table class="table table-condensed table-bordered mb27" style="width: 300px; margin:0 auto;">
			  <tbody>
			    <tr>
			      <td class="bg-primary col-md-3">媒体类型：</td>
			      <td>
			      	<select required class="form-control" placeholder="" id="mediaType1" name="mediaType1">
		        		<option value="">请选择</option>
			        </select>
			      </td>
			    </tr>
			    <tr id="trMediaType2">
			      <td class="bg-primary col-md-3"></td>
			      <td>
			      	<input type="input" class="form-control" name="mediaType1Alias" id="mediaType1Alias" value="<?=$gxData['mediaType1Alias']?>" placeholder="其它媒体类型">
			        <select class="form-control" placeholder="" id="mediaType2" name="mediaType2">
		        		<option value="">请选择</option>
			        </select>
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3">媒体名称</td>
			      <td>
			      <input required type="input" class="form-control" name="mediaName" id="mediaName" value="<?=$gxData['mediaName']?>" placeholder="项目名称">
			      </td>
			    </tr>
			    <tr id="trMediaSize">
			      <td class="bg-primary col-md-3">投放规格：</td>
			      <td>
				    <select class="form-control" placeholder="" id="mediaSize" name="mediaSize">
		        		<option value="">请选择</option>
			        </select>
			      </td>
			    </tr>
			    <tr id="trMediaSizeAlias1">
			      <td class="bg-primary col-md-3">长：</td>
			      <td>
			      	<input type="text" class="form-control width-100" id="mediaSizeAlias1" name="mediaSizeAlias1" value="<?=$gxData['mediaSizeAlias1']?>" placeholder="">
			      	<span>cm</span>
			      </td>
			    </tr>
			    <tr id="trMediaSizeAlias2">
			      <td class="bg-primary col-md-3">高：</td>
			      <td>
			      	<input type="text" class="form-control width-100" id="mediaSizeAlias2" name="mediaSizeAlias2" value="<?=$gxData['mediaSizeAlias2']?>" placeholder="">
			      	<span>cm</span>
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3">开始时间</td>
			      <td>
			      <input type="input" required class="form-control" onFocus="WdatePicker({minDate:'<?=((int)$projectData['isBubao'] || $isBubao || $isSpecialBubao === 2) ? $this->timeUnitModel->getTimeUnitStartDate($procData['timeUnit'], $procData['year']) : date("Y-m-d")?>',maxDate:'#F{$dp.$D(\'endTime\')||\'<?=$this->timeUnitModel->getTimeUnitEndDate($procData['timeUnit'], $procData['year'])?>\'}'})" name="startTime" id="startTime" value="<?=$gxData['startTime']?>" placeholder="开始时间">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3">结束时间</td>
			      <td>
			      	<input type="input" required class="form-control" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'startTime\')||\'<?=((int)$projectData['isBubao'] || $isBubao || $isSpecialBubao === 2) ? $this->timeUnitModel->getTimeUnitStartDate($procData['timeUnit'], $procData['year']) : date("Y-m-d")?>\'}',maxDate:'<?=$this->timeUnitModel->getTimeUnitEndDate($procData['timeUnit'], $procData['year'])?>'})" name="endTime" id="endTime" value="<?=$gxData['endTime']?>" placeholder="结束时间">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3">发布频次</td>
			      <td>
			      	<input type="number" min="0" class="form-control" name="frequency" id="frequency" value="<?=(float)$gxData['frequency']?$gxData['frequency']:''?>" placeholder="发布频次">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3">预算费用</td>
			      <td>
			      <input type="number" required min="0" step="0.01" class="form-control" name="budgetApply" id="budgetApply" value="<?=(float)$gxData['budgetApply']?$gxData['budgetApply']:''?>" placeholder="预算费用">
			      </td>
			    </tr>
			    <tr>
			      <td class="bg-primary col-md-3">备注</td>
			      <td>
			   		<textarea class="form-control" name="remarks" id="remarks" rows="3"><?=$gxData['remarks']?></textarea>
			      </td>
			    </tr>
			    <tr>
			      <td colspan="2" align="center">
			    	<button type="submit" class="btn btn-default btn-primary">保存</button>
			  		<button type="button" onclick="closeWindow()" class="btn btn-default btn-primary">取消</button>
			      </td>
			    </tr>
			    </tbody>
			  </table>
		</form>
<script type="text/javascript" src="public/js/commonGx.js"></script>
<script type="text/javascript">
$(function(){
  initValidation();
  $("#mediaSize,#inputMediaSizeAlias1,#inputMediaSizeAlias2").hide();
  mediaType1Display(<?=isset($gxData['mediaType1']) ? $gxData['mediaType1'] : 0?>);
  mediaType2Display(<?=isset($gxData['mediaType1']) ? $gxData['mediaType1'] : 0?>, <?=isset($gxData['mediaType2']) ? $gxData['mediaType2']:0?>);
  mediaSizeDisplay(<?=isset($gxData['mediaType1']) ? $gxData['mediaType1'] : 0?>, <?=isset($gxData['mediaType2']) ? $gxData['mediaType2']:0?>, <?=isset($gxData['mediaSize']) ? $gxData['mediaSize'] : 0?>, <?=isset($gxData['mediaSize']) ? $gxData['mediaSize'] : 0?>);
  $("#mediaType1").change(function(){
    mediaType2Display($("#mediaType1").val());
    mediaSizeDisplay($("#mediaType1").val(), 0, $("#mediaSize").val());
    initValidation();
  });
  $("#mediaType2").change(function(){
    mediaSizeDisplay($("#mediaType1").val(), $("#mediaType2").val());
    initValidation();
  });
  $("#mediaSize").change(function(){
    mediaSizeDisplay($("#mediaType1").val(), $("#mediaType2").val(), $("#mediaSize").val(), this.value);
    initValidation();
  });
});
//初始化验证
function initValidation(){
	$('form[name="add"]').find("input,select,textarea").jqBootstrapValidation("destroy");
	$('form[name="add"]').find("input,select,textarea").not("[type=submit]").jqBootstrapValidation({
	    preventSubmit:false,
	    submitSuccess: function (form, event) {
	         event.preventDefault();
	         ajaxFormSubmit('add');
	     },
	     submitError: function (form, event, errors) {
	       event.preventDefault();
	       }
  	});
}
</script>
<?php $this->load->view('common/foot');?>